package com.hqyj.system.config;

import com.hqyj.system.Interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 登录拦截，如需要关闭，注释掉@Configuration
 * @author Guo.Yang
 * @version 1.0
 * @date 2021/12/3 11:21
 */
@Configuration
public class MyMVCConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration interceptor = registry.addInterceptor(new MyInterceptor());
        interceptor.addPathPatterns("/**");
        interceptor.excludePathPatterns("/sys-user/login",
                "/registered/register","/hui/**","/img/**","/source/**");
    }
}
